home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectSound / EffectsBuffers / frmChorus.frm next >
Text File  |  2001-10-08  |  9KB  |  319 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmChorus 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Chorus Effects Update"
  6.    ClientHeight    =   4440
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   2775
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   4440
  14.    ScaleWidth      =   2775
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   1  'CenterOwner
  17.    Begin VB.CommandButton cmdOK 
  18.       Caption         =   "OK"
  19.       Height          =   315
  20.       Left            =   1800
  21.       TabIndex        =   15
  22.       Top             =   4020
  23.       Width           =   915
  24.    End
  25.    Begin VB.OptionButton optSin 
  26.       Caption         =   "Sine"
  27.       Height          =   255
  28.       Left            =   120
  29.       TabIndex        =   11
  30.       Top             =   3600
  31.       Width           =   915
  32.    End
  33.    Begin VB.OptionButton optTriangle 
  34.       Caption         =   "Triangle"
  35.       Height          =   255
  36.       Left            =   1680
  37.       TabIndex        =   10
  38.       Top             =   3600
  39.       Width           =   915
  40.    End
  41.    Begin MSComctlLib.Slider sldFeedback 
  42.       Height          =   195
  43.       Left            =   60
  44.       TabIndex        =   0
  45.       Top             =   360
  46.       Width           =   2655
  47.       _ExtentX        =   4683
  48.       _ExtentY        =   344
  49.       _Version        =   393216
  50.       LargeChange     =   10
  51.       Min             =   -99
  52.       Max             =   99
  53.       SelStart        =   1
  54.       TickFrequency   =   10
  55.       Value           =   1
  56.    End
  57.    Begin MSComctlLib.Slider sldDelay 
  58.       Height          =   195
  59.       Left            =   60
  60.       TabIndex        =   1
  61.       Top             =   900
  62.       Width           =   2655
  63.       _ExtentX        =   4683
  64.       _ExtentY        =   344
  65.       _Version        =   393216
  66.       Max             =   20
  67.       TickFrequency   =   2
  68.    End
  69.    Begin MSComctlLib.Slider sldDepth 
  70.       Height          =   195
  71.       Left            =   60
  72.       TabIndex        =   2
  73.       Top             =   1440
  74.       Width           =   2655
  75.       _ExtentX        =   4683
  76.       _ExtentY        =   344
  77.       _Version        =   393216
  78.       Max             =   100
  79.       TickFrequency   =   10
  80.    End
  81.    Begin MSComctlLib.Slider sldFreq 
  82.       Height          =   195
  83.       Left            =   60
  84.       TabIndex        =   3
  85.       Top             =   1980
  86.       Width           =   2655
  87.       _ExtentX        =   4683
  88.       _ExtentY        =   344
  89.       _Version        =   393216
  90.       TickFrequency   =   2
  91.    End
  92.    Begin MSComctlLib.Slider sldPhase 
  93.       Height          =   195
  94.       Left            =   60
  95.       TabIndex        =   8
  96.       Top             =   2520
  97.       Width           =   2655
  98.       _ExtentX        =   4683
  99.       _ExtentY        =   344
  100.       _Version        =   393216
  101.       LargeChange     =   2
  102.       Max             =   4
  103.    End
  104.    Begin MSComctlLib.Slider sldWetDry 
  105.       Height          =   195
  106.       Left            =   60
  107.       TabIndex        =   13
  108.       Top             =   3060
  109.       Width           =   2655
  110.       _ExtentX        =   4683
  111.       _ExtentY        =   344
  112.       _Version        =   393216
  113.       LargeChange     =   10
  114.       SmallChange     =   5
  115.       Max             =   100
  116.       SelStart        =   1
  117.       TickFrequency   =   10
  118.       Value           =   1
  119.    End
  120.    Begin VB.Label lbl 
  121.       BackStyle       =   0  'Transparent
  122.       Caption         =   "Wet Dry Mix"
  123.       Height          =   255
  124.       Index           =   6
  125.       Left            =   60
  126.       TabIndex        =   14
  127.       Top             =   2820
  128.       Width           =   1035
  129.    End
  130.    Begin VB.Label lbl 
  131.       BackStyle       =   0  'Transparent
  132.       Caption         =   "Wave Form"
  133.       Height          =   255
  134.       Index           =   5
  135.       Left            =   60
  136.       TabIndex        =   12
  137.       Top             =   3360
  138.       Width           =   915
  139.    End
  140.    Begin VB.Label lbl 
  141.       BackStyle       =   0  'Transparent
  142.       Caption         =   "Phase"
  143.       Height          =   255
  144.       Index           =   2
  145.       Left            =   60
  146.       TabIndex        =   9
  147.       Top             =   2280
  148.       Width           =   1035
  149.    End
  150.    Begin VB.Label lbl 
  151.       BackStyle       =   0  'Transparent
  152.       Caption         =   "Feedback"
  153.       Height          =   255
  154.       Index           =   1
  155.       Left            =   60
  156.       TabIndex        =   7
  157.       Top             =   120
  158.       Width           =   735
  159.    End
  160.    Begin VB.Label lbl 
  161.       BackStyle       =   0  'Transparent
  162.       Caption         =   "Delay"
  163.       Height          =   255
  164.       Index           =   0
  165.       Left            =   60
  166.       TabIndex        =   6
  167.       Top             =   660
  168.       Width           =   735
  169.    End
  170.    Begin VB.Label lbl 
  171.       BackStyle       =   0  'Transparent
  172.       Caption         =   "Depth"
  173.       Height          =   255
  174.       Index           =   3
  175.       Left            =   60
  176.       TabIndex        =   5
  177.       Top             =   1200
  178.       Width           =   1035
  179.    End
  180.    Begin VB.Label lbl 
  181.       BackStyle       =   0  'Transparent
  182.       Caption         =   "Frequency"
  183.       Height          =   255
  184.       Index           =   4
  185.       Left            =   60
  186.       TabIndex        =   4
  187.       Top             =   1740
  188.       Width           =   1035
  189.    End
  190. End
  191. Attribute VB_Name = "frmChorus"
  192. Attribute VB_GlobalNameSpace = False
  193. Attribute VB_Creatable = False
  194. Attribute VB_PredeclaredId = True
  195. Attribute VB_Exposed = False
  196. Option Explicit
  197. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  198. '
  199. '  Copyright (C) 1999-2001 Microsoft Corporation.  All Rights Reserved.
  200. '
  201. '  File:       frmChorus.frm
  202. '
  203. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  204. Private oBuffer As DirectSoundSecondaryBuffer8
  205. Private mlIndex As Long
  206.  
  207. Private oFX As DirectSoundFXChorus8
  208.  
  209. Private Sub SaveAllSettings()
  210.     Dim fxNew As DSFXCHORUS
  211.     
  212.     'Ok, save these new settings
  213.     'Set the new information up
  214.     With fxNew
  215.         .fFeedback = CSng(sldFeedback.Value)
  216.         .fDelay = CSng(sldDelay.Value)
  217.         .fDepth = CSng(sldDepth.Value)
  218.         .fWetDryMix = CSng(sldWetDry.Value)
  219.         .fFrequency = CSng(sldFreq.Value)
  220.         .lPhase = sldPhase.Value
  221.         If optSin.Value Then
  222.             .lWaveform = DSFX_WAVE_SIN
  223.         ElseIf optTriangle.Value Then
  224.             .lWaveform = DSFX_WAVE_TRIANGLE
  225.         End If
  226.     End With
  227.     'Now update the effect
  228.     oFX.SetAllParameters fxNew
  229. End Sub
  230. Private Sub cmdOK_Click()
  231.     SaveAllSettings
  232.     Unload Me
  233. End Sub
  234.  
  235. Private Sub Form_Load()
  236.     Dim fxCurrent As DSFXCHORUS
  237.     
  238.     'Get the echo interface
  239.     Set oFX = oBuffer.GetObjectinPath(DSFX_STANDARD_CHORUS, mlIndex, IID_DirectSoundFXChorus)
  240.     'Get the current settings from it
  241.     fxCurrent = oFX.GetAllParameters
  242.     'Now put them out there
  243.     With fxCurrent
  244.         sldFeedback.Value = CLng(.fFeedback)
  245.         sldDelay.Value = CLng(.fDelay)
  246.         sldDepth.Value = CLng(.fDepth)
  247.         sldWetDry.Value = CLng(.fWetDryMix)
  248.         sldFreq.Value = CLng(.fFrequency)
  249.         sldPhase.Value = .lPhase
  250.         If .lWaveform = DSFX_WAVE_SIN Then
  251.             optSin.Value = True
  252.         ElseIf .lWaveform = DSFX_WAVE_TRIANGLE Then
  253.             optTriangle.Value = True
  254.         End If
  255.     End With
  256. End Sub
  257.  
  258. Public Sub SetBuffer(oBuf As DirectSoundSecondaryBuffer8, Index As Long)
  259.     'Store the buffer and index
  260.     Set oBuffer = oBuf
  261.     mlIndex = Index
  262. End Sub
  263.  
  264. Private Sub optSin_Click()
  265.     SaveAllSettings
  266. End Sub
  267.  
  268. Private Sub optTriangle_Click()
  269.     SaveAllSettings
  270. End Sub
  271.  
  272. Private Sub sldDelay_Change()
  273.     SaveAllSettings
  274. End Sub
  275.  
  276. Private Sub sldDelay_Scroll()
  277.     SaveAllSettings
  278. End Sub
  279.  
  280. Private Sub sldDepth_Change()
  281.     SaveAllSettings
  282. End Sub
  283.  
  284. Private Sub sldDepth_Scroll()
  285.     SaveAllSettings
  286. End Sub
  287.  
  288. Private Sub sldFeedback_Change()
  289.     SaveAllSettings
  290. End Sub
  291.  
  292. Private Sub sldFeedback_Scroll()
  293.     SaveAllSettings
  294. End Sub
  295.  
  296. Private Sub sldFreq_Change()
  297.     SaveAllSettings
  298. End Sub
  299.  
  300. Private Sub sldFreq_Scroll()
  301.     SaveAllSettings
  302. End Sub
  303.  
  304. Private Sub sldPhase_Change()
  305.     SaveAllSettings
  306. End Sub
  307.  
  308. Private Sub sldPhase_Scroll()
  309.     SaveAllSettings
  310. End Sub
  311.  
  312. Private Sub sldWetDry_Change()
  313.     SaveAllSettings
  314. End Sub
  315.  
  316. Private Sub sldWetDry_Scroll()
  317.     SaveAllSettings
  318. End Sub
  319.